home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00111_Drink text behavior.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  2.6 KB  |  130 lines

  1. property pSpr, pLastDirection, pOldTabs, pLastVisible
  2.  
  3. on beginSprite me
  4.   pSpr = sprite(me.spriteNum)
  5.   pSpr.visible = 0
  6.   pLastDirection = #bottom
  7.   pOldTabs = pSpr.member.Tabs
  8.   customFont(pSpr.member)
  9. end
  10.  
  11. on endSprite me
  12.   pSpr.visible = 1
  13. end
  14.  
  15. on mouseEnter me
  16.   showToolTip(sprite(me.spriteNum), #contentslist, point(pSpr.rect.left, pSpr.rect.bottom + 2), 1)
  17. end
  18.  
  19. on mouseLeave me
  20.   hideToolTip()
  21. end
  22.  
  23. on mShowDrinkContents me, tipText, forceUpdateToText
  24.   if not forceUpdateToText then
  25.     if pSpr.visible = 0 then
  26.       exit
  27.     end if
  28.   end if
  29.   if not voidp(tipText) then
  30.     if pSpr.member.text <> tipText then
  31.       pSpr.member.text = tipText
  32.       pSpr.member.Tabs = pOldTabs
  33.     end if
  34.   end if
  35.   notifyPourWindow(me)
  36. end
  37.  
  38. on mShowIfPreviouslyVisible me
  39.   if pLastVisible then
  40.     mShowDrinkContents(me, VOID, 1)
  41.     pSpr.visible = 1
  42.   end if
  43. end
  44.  
  45. on mouseDown me
  46.   if the doubleClick then
  47.     mHideDrinkContents()
  48.     exit
  49.   end if
  50.   startLoc = pSpr.loc
  51.   myOffset = the clickLoc - point(pSpr.left, pSpr.top)
  52.   repeat while the stillDown
  53.     checkElapsedTime()
  54.     pSpr.loc = the mouseLoc - myOffset
  55.     updateStage()
  56.   end repeat
  57.   if not rectOnStage(pSpr.rect) then
  58.     pSpr.loc = startLoc
  59.     mHideDrinkContents(me)
  60.   else
  61.     if pSpr.loc <> startLoc then
  62.       undockText(me)
  63.     end if
  64.   end if
  65. end
  66.  
  67. on mHideIfDocked me
  68.   if pLastDirection <> #undocked then
  69.     mHideDrinkContents(me)
  70.   end if
  71. end
  72.  
  73. on mHideDrinkContents me
  74.   pSpr.visible = 0
  75.   oldDirection = pLastDirection
  76.   pLastDirection = #undocked
  77.   notifyPourWindow(me)
  78.   pLastDirection = oldDirection
  79. end
  80.  
  81. on mRepositionSelf me, direction, visFlag
  82.   global gPourWindow
  83.   if voidp(gPourWindow) then
  84.     exit
  85.   end if
  86.   if not voidp(direction) then
  87.     pLastDirection = direction
  88.   end if
  89.   if not voidp(visFlag) then
  90.     pSpr.visible = visFlag
  91.     pLastVisible = visFlag
  92.   end if
  93.   if pSpr.visible = 0 then
  94.     exit
  95.   end if
  96.   pwRect = offset(gPourWindow.rect, -(the stageLeft), -(the stageTop))
  97.   startLoc = pSpr.loc
  98.   if rectOnStage(pwRect) then
  99.     case pLastDirection of
  100.       #right:
  101.         pSpr.loc = point(pwRect.right + 3, pwRect.top + 3)
  102.       #bottom:
  103.         pSpr.loc = point(pwRect.left, pwRect.bottom + 3)
  104.       #left:
  105.         pSpr.loc = point(pwRect.left - pSpr.rect.width, pwRect.top + 3)
  106.     end case
  107.     updateStage()
  108.     if not rectOnStage(pSpr.rect) then
  109.       pSpr.loc = startLoc
  110.       undockText(me)
  111.     end if
  112.   else
  113.     undockText(me)
  114.   end if
  115. end
  116.  
  117. on undockText me
  118.   pLastDirection = #undocked
  119.   notifyPourWindow(me)
  120. end
  121.  
  122. on notifyPourWindow me
  123.   global gPourWindow
  124.   if isWindow(gPourWindow) then
  125.     tell gPourWindow
  126.       reinstateArrows(pLastDirection)
  127.     end tell
  128.   end if
  129. end
  130.